package org.ruanjj.palindromenumber;

public class Solution {
    public boolean isPalindrome(int x) {
        if(x < 0 || (x % 10 == 0 && x != 0)){
            return false;
        }

        int palindromeRes = 0;

        while(x > palindromeRes){
            palindromeRes = palindromeRes * 10 + x % 10;
            x = x/10;
        }
        return x == palindromeRes/10 || x == palindromeRes;
    }
}
